From: Matthias Clasen Date: Sun, 7 Jun 2015 18:01:39 +0000 (-0400) Subject: entry: Never show handles and popover at the same time X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~6664 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a219e6b4cd1e0863b4e9db11a3131e40f89acdda;p=gtk%2B3.0.git entry: Never show handles and popover at the same time Hide the handles when the popover appears, and brind them back when it disappears. This will need revisiting if we start using the popover for mouse interaction as well, where we may not want handles to show up. --- diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 8813486e51..d81bbeaede 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -9683,6 +9683,31 @@ gtk_entry_popup_menu (GtkWidget *widget) return TRUE; } +static void +show_or_hide_handles (GtkWidget *popover, + GParamSpec *pspec, + GtkEntry *entry) +{ + gboolean visible; + GtkTextHandle *handle; + GtkTextHandleMode mode; + + visible = gtk_widget_get_visible (popover); + + handle = entry->priv->text_handle; + mode = _gtk_text_handle_get_mode (handle); + + if (mode == GTK_TEXT_HANDLE_MODE_CURSOR) + { + _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_CURSOR, !visible); + } + else if (mode == GTK_TEXT_HANDLE_MODE_SELECTION) + { + _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START, !visible); + _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END, !visible); + } +} + static void activate_bubble_cb (GtkWidget *item, GtkEntry *entry) @@ -9756,6 +9781,8 @@ bubble_targets_received (GtkClipboard *clipboard, GTK_STYLE_CLASS_TOUCH_SELECTION); gtk_popover_set_position (GTK_POPOVER (priv->selection_bubble), GTK_POS_BOTTOM); gtk_popover_set_modal (GTK_POPOVER (priv->selection_bubble), FALSE); + g_signal_connect (priv->selection_bubble, "notify::visible", + G_CALLBACK (show_or_hide_handles), entry); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); g_object_set (box, "margin", 10, NULL);